******************************************************************************
*** PAPER: THE ITALIAN POLITICAL CLASS
*** FILE NAME: "1 - fieldwork analysis"
*** AUTHOR: Isernia, Martini, Olmastroni, Verzichelli
*** DATASET: "surveydata_01.dta"
*** SECTIONS: *1. FIELDWORK ANALYSIS: MUNICIPALITY DATA
			  *2. FIELDWORK ANALYSIS: REGION DATA
			  *3. FIELDWORK ANALYSIS: NATIONAL/EU DATA
*******************************************************************************/


					
****1. FIELDWORK: MUNICIPALITY DATA
	clear all
	*SET DIRECTORY
	
	use "surveydata_01.dta"
	split datestart, p(" ")
		
	recode completion (0=1) (1 2 3 4=0), into(completed)
	recode completion (0=0) (1 2 3 4=1), into(partial)
	
	keep datestart1 completed partial level
	
	rename datestart1 datestart

	label define level 1 "municipal" 2 "regional" 3 "national/EU", replace

	gen level2="municipal" if level==1
	replace level2="regional" if level==2
	replace level2="national/EU" if level==3
	
	sort datestart
	keep if level2=="municipal"

	*to get information on n per day
	*collapse (sum) completed, by(datestart)
	*gen cumulative_ncompleted = sum(completed)
	
	*collapse (sum) partial, by(datestart)
	*gen cumulative_npartial = sum(partial)

	*add info on ncompleted
	gen ncompleted=276 if datestart=="2020-10-20"
	replace ncompleted=243 if datestart=="2020-10-21"
	replace ncompleted=51 if datestart=="2020-10-22"
	replace ncompleted=26 if datestart=="2020-10-23"
	replace ncompleted=7 if datestart=="2020-10-24"
	replace ncompleted=16 if datestart=="2020-10-25"
	replace ncompleted=248 if datestart=="2020-10-26"
	replace ncompleted=141 if datestart=="2020-10-27"
	replace ncompleted=47 if datestart=="2020-10-28"
	replace ncompleted=25 if datestart=="2020-10-29"
	replace ncompleted=15 if datestart=="2020-10-30"
	replace ncompleted=4 if datestart=="2020-10-31"
	replace ncompleted=4 if datestart=="2020-11-01"
	replace ncompleted=17 if datestart=="2020-11-02"
	replace ncompleted=11 if datestart=="2020-11-03"
	replace ncompleted=6 if datestart=="2020-11-04"
	replace ncompleted=13 if datestart=="2020-11-05"
	replace ncompleted=16 if datestart=="2020-11-06"
	replace ncompleted=4 if datestart=="2020-11-07"
	replace ncompleted=2 if datestart=="2020-11-08"
	replace ncompleted=18 if datestart=="2020-11-09"
	replace ncompleted=12 if datestart=="2020-11-10"
	replace ncompleted=15 if datestart=="2020-11-11"
	replace ncompleted=24 if datestart=="2020-11-12"
	replace ncompleted=108 if datestart=="2020-11-13"
	replace ncompleted=35 if datestart=="2020-11-14"
	replace ncompleted=20 if datestart=="2020-11-15"
	replace ncompleted=32 if datestart=="2020-11-16"
	replace ncompleted=21 if datestart=="2020-11-17"
	replace ncompleted=7 if datestart=="2020-11-18"
	replace ncompleted=9 if datestart=="2020-11-19"
	replace ncompleted=3 if datestart=="2020-11-20"
	replace ncompleted=2 if datestart=="2020-11-21"
	replace ncompleted=3 if datestart=="2020-11-22"
	replace ncompleted=4 if datestart=="2020-11-23"
	replace ncompleted=13 if datestart=="2020-11-24"
	replace ncompleted=2 if datestart=="2020-11-25"
	replace ncompleted=3 if datestart=="2020-11-26"
	replace ncompleted=1 if datestart=="2020-11-28"
	replace ncompleted=1 if datestart=="2020-11-29"
	replace ncompleted=1 if datestart=="2020-11-30"
	replace ncompleted=2 if datestart=="2020-12-02"
	replace ncompleted=1 if datestart=="2020-12-04"
	replace ncompleted=1 if datestart=="2020-12-07"
	replace ncompleted=0 if datestart=="2020-12-09"
	replace ncompleted=1 if datestart=="2020-12-10"
	replace ncompleted=0 if datestart=="2020-12-11"
	replace ncompleted=120 if datestart=="2020-12-12"
	replace ncompleted=32 if datestart=="2020-12-13"
	replace ncompleted=50 if datestart=="2020-12-14"
	replace ncompleted=15 if datestart=="2020-12-15"
	replace ncompleted=17 if datestart=="2020-12-16"
	replace ncompleted=15 if datestart=="2020-12-17"
	replace ncompleted=12 if datestart=="2020-12-18"
	replace ncompleted=3 if datestart=="2020-12-19"
	replace ncompleted=1 if datestart=="2020-12-20"
	replace ncompleted=6 if datestart=="2020-12-21"
	replace ncompleted=12 if datestart=="2020-12-22"
	replace ncompleted=4 if datestart=="2020-12-23"
	replace ncompleted=2 if datestart=="2020-12-24"
	replace ncompleted=2 if datestart=="2020-12-27"
	replace ncompleted=3 if datestart=="2020-12-28"
	replace ncompleted=0 if datestart=="2020-12-29"
	replace ncompleted=2 if datestart=="2020-12-30"
	replace ncompleted=0 if datestart=="2020-12-31"
	replace ncompleted=1 if datestart=="2021-01-03"
	replace ncompleted=0 if datestart=="2021-01-05"
	replace ncompleted=0 if datestart=="2021-01-06"
	replace ncompleted=2 if datestart=="2021-01-11"
	replace ncompleted=1 if datestart=="2021-01-12"
	replace ncompleted=1 if datestart=="2021-01-18"
	replace ncompleted=1 if datestart=="2021-01-23"
	replace ncompleted=1 if datestart=="2021-01-26"

	*add info on npartial
	gen npartial=75 if datestart=="2020-10-20"
	replace npartial=60 if datestart=="2020-10-21"
	replace npartial=10 if datestart=="2020-10-22"
	replace npartial=5 if datestart=="2020-10-23"
	replace npartial=5 if datestart=="2020-10-24"
	replace npartial=0 if datestart=="2020-10-25"
	replace npartial=56 if datestart=="2020-10-26"
	replace npartial=21 if datestart=="2020-10-27"
	replace npartial=12 if datestart=="2020-10-28"
	replace npartial=3 if datestart=="2020-10-29"
	replace npartial=3 if datestart=="2020-10-30"
	replace npartial=1 if datestart=="2020-10-31"
	replace npartial=0 if datestart=="2020-11-01"
	replace npartial=5 if datestart=="2020-11-02"
	replace npartial=3 if datestart=="2020-11-03"
	replace npartial=0 if datestart=="2020-11-04"
	replace npartial=1 if datestart=="2020-11-05"
	replace npartial=0 if datestart=="2020-11-06"
	replace npartial=3 if datestart=="2020-11-07"
	replace npartial=0 if datestart=="2020-11-08"
	replace npartial=1 if datestart=="2020-11-09"
	replace npartial=4 if datestart=="2020-11-10"
	replace npartial=6 if datestart=="2020-11-11"
	replace npartial=5 if datestart=="2020-11-12"
	replace npartial=48 if datestart=="2020-11-13"
	replace npartial=7 if datestart=="2020-11-14"
	replace npartial=6 if datestart=="2020-11-15"
	replace npartial=6 if datestart=="2020-11-16"
	replace npartial=2 if datestart=="2020-11-17"
	replace npartial=2 if datestart=="2020-11-18"
	replace npartial=3 if datestart=="2020-11-19"
	replace npartial=1 if datestart=="2020-11-20"
	replace npartial=1 if datestart=="2020-11-21"
	replace npartial=0 if datestart=="2020-11-22"
	replace npartial=4 if datestart=="2020-11-23"
	replace npartial=2 if datestart=="2020-11-24"
	replace npartial=0 if datestart=="2020-11-25"
	replace npartial=1 if datestart=="2020-11-26"
	replace npartial=0 if datestart=="2020-11-28"
	replace npartial=1 if datestart=="2020-11-29"
	replace npartial=1 if datestart=="2020-11-30"
	replace npartial=0 if datestart=="2020-12-02"
	replace npartial=1 if datestart=="2020-12-04"
	replace npartial=0 if datestart=="2020-12-07"
	replace npartial=1 if datestart=="2020-12-09"
	replace npartial=1 if datestart=="2020-12-10"
	replace npartial=1 if datestart=="2020-12-11"
	replace npartial=48 if datestart=="2020-12-12"
	replace npartial=18 if datestart=="2020-12-13"
	replace npartial=16 if datestart=="2020-12-14"
	replace npartial=10 if datestart=="2020-12-15"
	replace npartial=0 if datestart=="2020-12-16"
	replace npartial=4 if datestart=="2020-12-17"
	replace npartial=4 if datestart=="2020-12-18"
	replace npartial=2 if datestart=="2020-12-19"
	replace npartial=1 if datestart=="2020-12-20"
	replace npartial=2 if datestart=="2020-12-21"
	replace npartial=1 if datestart=="2020-12-22"
	replace npartial=0 if datestart=="2020-12-23"
	replace npartial=0 if datestart=="2020-12-24"
	replace npartial=0 if datestart=="2020-12-27"
	replace npartial=0 if datestart=="2020-12-28"
	replace npartial=1 if datestart=="2020-12-29"
	replace npartial=0 if datestart=="2020-12-30"
	replace npartial=1 if datestart=="2020-12-31"
	replace npartial=1 if datestart=="2021-01-03"
	replace npartial=1 if datestart=="2021-01-05"
	replace npartial=1 if datestart=="2021-01-06"
	replace npartial=0 if datestart=="2021-01-11"
	replace npartial=1 if datestart=="2021-01-12"
	replace npartial=0 if datestart=="2021-01-18"
	replace npartial=0 if datestart=="2021-01-23"
	replace npartial=0 if datestart=="2021-01-26"
	
	*add info on cumulative_ncompleted
	gen cumulative_ncompleted=276 if datestart=="2020-10-20"
	replace cumulative_ncompleted=519 if datestart=="2020-10-21"
	replace cumulative_ncompleted=570 if datestart=="2020-10-22"
	replace cumulative_ncompleted=596 if datestart=="2020-10-23"
	replace cumulative_ncompleted=603 if datestart=="2020-10-24"
	replace cumulative_ncompleted=619 if datestart=="2020-10-25"
	replace cumulative_ncompleted=867 if datestart=="2020-10-26"
	replace cumulative_ncompleted=1008 if datestart=="2020-10-27"
	replace cumulative_ncompleted=1055 if datestart=="2020-10-28"
	replace cumulative_ncompleted=1080 if datestart=="2020-10-29"
	replace cumulative_ncompleted=1095 if datestart=="2020-10-30"
	replace cumulative_ncompleted=1099 if datestart=="2020-10-31"
	replace cumulative_ncompleted=1103 if datestart=="2020-11-01"
	replace cumulative_ncompleted=1120 if datestart=="2020-11-02"
	replace cumulative_ncompleted=1131 if datestart=="2020-11-03"
	replace cumulative_ncompleted=1137 if datestart=="2020-11-04"
	replace cumulative_ncompleted=1150 if datestart=="2020-11-05"
	replace cumulative_ncompleted=1166 if datestart=="2020-11-06"
	replace cumulative_ncompleted=1170 if datestart=="2020-11-07"
	replace cumulative_ncompleted=1172 if datestart=="2020-11-08"
	replace cumulative_ncompleted=1190 if datestart=="2020-11-09"
	replace cumulative_ncompleted=1202 if datestart=="2020-11-10"
	replace cumulative_ncompleted=1217 if datestart=="2020-11-11"
	replace cumulative_ncompleted=1241 if datestart=="2020-11-12"
	replace cumulative_ncompleted=1349 if datestart=="2020-11-13"
	replace cumulative_ncompleted=1384 if datestart=="2020-11-14"
	replace cumulative_ncompleted=1404 if datestart=="2020-11-15"
	replace cumulative_ncompleted=1436 if datestart=="2020-11-16"
	replace cumulative_ncompleted=1457 if datestart=="2020-11-17"
	replace cumulative_ncompleted=1464 if datestart=="2020-11-18"
	replace cumulative_ncompleted=1473 if datestart=="2020-11-19"
	replace cumulative_ncompleted=1476 if datestart=="2020-11-20"
	replace cumulative_ncompleted=1478 if datestart=="2020-11-21"
	replace cumulative_ncompleted=1481 if datestart=="2020-11-22"
	replace cumulative_ncompleted=1485 if datestart=="2020-11-23"
	replace cumulative_ncompleted=1498 if datestart=="2020-11-24"
	replace cumulative_ncompleted=1500 if datestart=="2020-11-25"
	replace cumulative_ncompleted=1503 if datestart=="2020-11-26"
	replace cumulative_ncompleted=1504 if datestart=="2020-11-28"
	replace cumulative_ncompleted=1505 if datestart=="2020-11-29"
	replace cumulative_ncompleted=1506 if datestart=="2020-11-30"
	replace cumulative_ncompleted=1508 if datestart=="2020-12-02"
	replace cumulative_ncompleted=1509 if datestart=="2020-12-04"
	replace cumulative_ncompleted=1510 if datestart=="2020-12-07"
	replace cumulative_ncompleted=1510 if datestart=="2020-12-09"
	replace cumulative_ncompleted=1511 if datestart=="2020-12-10"
	replace cumulative_ncompleted=1511 if datestart=="2020-12-11"
	replace cumulative_ncompleted=1631 if datestart=="2020-12-12"
	replace cumulative_ncompleted=1663 if datestart=="2020-12-13"
	replace cumulative_ncompleted=1713 if datestart=="2020-12-14"
	replace cumulative_ncompleted=1728 if datestart=="2020-12-15"
	replace cumulative_ncompleted=1745 if datestart=="2020-12-16"
	replace cumulative_ncompleted=1760 if datestart=="2020-12-17"
	replace cumulative_ncompleted=1772 if datestart=="2020-12-18"
	replace cumulative_ncompleted=1775 if datestart=="2020-12-19"
	replace cumulative_ncompleted=1776 if datestart=="2020-12-20"
	replace cumulative_ncompleted=1782 if datestart=="2020-12-21"
	replace cumulative_ncompleted=1794 if datestart=="2020-12-22"
	replace cumulative_ncompleted=1798 if datestart=="2020-12-23"
	replace cumulative_ncompleted=1800 if datestart=="2020-12-24"
	replace cumulative_ncompleted=1802 if datestart=="2020-12-27"
	replace cumulative_ncompleted=1805 if datestart=="2020-12-28"
	replace cumulative_ncompleted=1805 if datestart=="2020-12-29"
	replace cumulative_ncompleted=1807 if datestart=="2020-12-30"
	replace cumulative_ncompleted=1807 if datestart=="2020-12-31"
	replace cumulative_ncompleted=1808 if datestart=="2021-01-03"
	replace cumulative_ncompleted=1808 if datestart=="2021-01-05"
	replace cumulative_ncompleted=1808 if datestart=="2021-01-06"
	replace cumulative_ncompleted=1810 if datestart=="2021-01-11"
	replace cumulative_ncompleted=1811 if datestart=="2021-01-12"
	replace cumulative_ncompleted=1812 if datestart=="2021-01-18"
	replace cumulative_ncompleted=1813 if datestart=="2021-01-23"
	replace cumulative_ncompleted=1814 if datestart=="2021-01-26"
	
	*add info on cumulative_npartial
	gen cumulative_npartial=75 if datestart=="2020-10-20"
	replace cumulative_npartial=135 if datestart=="2020-10-21"
	replace cumulative_npartial=145 if datestart=="2020-10-22"
	replace cumulative_npartial=150 if datestart=="2020-10-23"
	replace cumulative_npartial=155 if datestart=="2020-10-24"
	replace cumulative_npartial=155 if datestart=="2020-10-25"
	replace cumulative_npartial=211 if datestart=="2020-10-26"
	replace cumulative_npartial=232 if datestart=="2020-10-27"
	replace cumulative_npartial=244 if datestart=="2020-10-28"
	replace cumulative_npartial=247 if datestart=="2020-10-29"
	replace cumulative_npartial=250 if datestart=="2020-10-30"
	replace cumulative_npartial=251 if datestart=="2020-10-31"
	replace cumulative_npartial=251 if datestart=="2020-11-01"
	replace cumulative_npartial=256 if datestart=="2020-11-02"
	replace cumulative_npartial=259 if datestart=="2020-11-03"
	replace cumulative_npartial=259 if datestart=="2020-11-04"
	replace cumulative_npartial=260 if datestart=="2020-11-05"
	replace cumulative_npartial=260 if datestart=="2020-11-06"
	replace cumulative_npartial=263 if datestart=="2020-11-07"
	replace cumulative_npartial=263 if datestart=="2020-11-08"
	replace cumulative_npartial=264 if datestart=="2020-11-09"
	replace cumulative_npartial=268 if datestart=="2020-11-10"
	replace cumulative_npartial=274 if datestart=="2020-11-11"
	replace cumulative_npartial=279 if datestart=="2020-11-12"
	replace cumulative_npartial=327 if datestart=="2020-11-13"
	replace cumulative_npartial=334 if datestart=="2020-11-14"
	replace cumulative_npartial=340 if datestart=="2020-11-15"
	replace cumulative_npartial=346 if datestart=="2020-11-16"
	replace cumulative_npartial=348 if datestart=="2020-11-17"
	replace cumulative_npartial=350 if datestart=="2020-11-18"
	replace cumulative_npartial=353 if datestart=="2020-11-19"
	replace cumulative_npartial=354 if datestart=="2020-11-20"
	replace cumulative_npartial=355 if datestart=="2020-11-21"
	replace cumulative_npartial=355 if datestart=="2020-11-22"
	replace cumulative_npartial=359 if datestart=="2020-11-23"
	replace cumulative_npartial=361 if datestart=="2020-11-24"
	replace cumulative_npartial=361 if datestart=="2020-11-25"
	replace cumulative_npartial=362 if datestart=="2020-11-26"
	replace cumulative_npartial=362 if datestart=="2020-11-28"
	replace cumulative_npartial=363 if datestart=="2020-11-29"
	replace cumulative_npartial=364 if datestart=="2020-11-30"
	replace cumulative_npartial=364 if datestart=="2020-12-02"
	replace cumulative_npartial=365 if datestart=="2020-12-04"
	replace cumulative_npartial=365 if datestart=="2020-12-07"
	replace cumulative_npartial=366 if datestart=="2020-12-09"
	replace cumulative_npartial=367 if datestart=="2020-12-10"
	replace cumulative_npartial=368 if datestart=="2020-12-11"
	replace cumulative_npartial=416 if datestart=="2020-12-12"
	replace cumulative_npartial=434 if datestart=="2020-12-13"
	replace cumulative_npartial=450 if datestart=="2020-12-14"
	replace cumulative_npartial=460 if datestart=="2020-12-15"
	replace cumulative_npartial=460 if datestart=="2020-12-16"
	replace cumulative_npartial=464 if datestart=="2020-12-17"
	replace cumulative_npartial=468 if datestart=="2020-12-18"
	replace cumulative_npartial=470 if datestart=="2020-12-19"
	replace cumulative_npartial=471 if datestart=="2020-12-20"
	replace cumulative_npartial=473 if datestart=="2020-12-21"
	replace cumulative_npartial=474 if datestart=="2020-12-22"
	replace cumulative_npartial=474 if datestart=="2020-12-23"
	replace cumulative_npartial=474 if datestart=="2020-12-24"
	replace cumulative_npartial=474 if datestart=="2020-12-27"
	replace cumulative_npartial=474 if datestart=="2020-12-28"
	replace cumulative_npartial=475 if datestart=="2020-12-29"
	replace cumulative_npartial=475 if datestart=="2020-12-30"
	replace cumulative_npartial=476 if datestart=="2020-12-31"
	replace cumulative_npartial=477 if datestart=="2021-01-03"
	replace cumulative_npartial=478 if datestart=="2021-01-05"
	replace cumulative_npartial=479 if datestart=="2021-01-06"
	replace cumulative_npartial=479 if datestart=="2021-01-11"
	replace cumulative_npartial=480 if datestart=="2021-01-12"
	replace cumulative_npartial=480 if datestart=="2021-01-18"
	replace cumulative_npartial=480 if datestart=="2021-01-23"
	replace cumulative_npartial=480 if datestart=="2021-01-26"

	label var datestart "date start"
	label var level "level of election"
	label var completed "completed 1/0"
	label var partial "partial 1/0"
	label var ncompleted "n completed"
	label var npartial "n partial"
	label var cumulative_ncompleted "N cumulative completed"
	label var cumulative_npartial "N cumulative partial"
	
	drop level
	rename level2 level
	order level
	
	saveold "field_municipal.dta", replace version(12)


****2. FIELDWORK: REGION DATA FIGURE
	clear all
	*SET DIRECTORY
	
	use "surveydata_01.dta"
	split datestart, p(" ")
		
	recode completion (0=1) (1 2 3 4=0), into(completed)
	recode completion (0=0) (1 2 3 4=1), into(partial)
	
	keep datestart1 completed partial level
	
	rename datestart1 datestart

	label define level 1 "municipal" 2 "regional" 3 "national/EU", replace

	gen level2="municipal" if level==1
	replace level2="regional" if level==2
	replace level2="national/EU" if level==3
	
	sort datestart
	keep if level2=="regional"

	*to get information on n per day
	*collapse (sum) completed, by(datestart)
	*gen cumulative_ncompleted = sum(completed)
	
	*collapse (sum) partial, by(datestart)
	*gen cumulative_npartial = sum(partial)

	*add info on ncompleted
	gen ncompleted=7 if datestart=="2020-09-30"
	replace ncompleted=10 if datestart=="2020-10-01"
	replace ncompleted=3 if datestart=="2020-10-02"
	replace ncompleted=3 if datestart=="2020-10-08"
	replace ncompleted=8 if datestart=="2020-10-09"
	replace ncompleted=1 if datestart=="2020-10-10"
	replace ncompleted=1 if datestart=="2020-10-12"
	replace ncompleted=4 if datestart=="2020-10-16"
	replace ncompleted=1 if datestart=="2020-10-17"
	replace ncompleted=5 if datestart=="2020-10-19"
	replace ncompleted=0 if datestart=="2020-10-20"
	replace ncompleted=1 if datestart=="2020-10-29"
	replace ncompleted=4 if datestart=="2020-10-31"
	replace ncompleted=1 if datestart=="2020-11-01"
	replace ncompleted=3 if datestart=="2020-11-02"
	replace ncompleted=0 if datestart=="2020-11-03"
	replace ncompleted=3 if datestart=="2020-11-10"
	replace ncompleted=3 if datestart=="2020-11-11"
	replace ncompleted=1 if datestart=="2020-11-12"
	replace ncompleted=1 if datestart=="2020-11-13"
	replace ncompleted=1 if datestart=="2020-11-14"
	replace ncompleted=8 if datestart=="2020-11-16"
	replace ncompleted=3 if datestart=="2020-11-18"
	replace ncompleted=2 if datestart=="2020-11-19"
	replace ncompleted=3 if datestart=="2020-11-20"
	replace ncompleted=0 if datestart=="2020-11-21"
	replace ncompleted=1 if datestart=="2020-11-22"
	replace ncompleted=1 if datestart=="2020-11-23"
	replace ncompleted=3 if datestart=="2020-11-24"
	replace ncompleted=1 if datestart=="2020-11-25"
	replace ncompleted=1 if datestart=="2020-11-26"
	replace ncompleted=2 if datestart=="2020-11-30"
	replace ncompleted=4 if datestart=="2020-12-01"
	replace ncompleted=1 if datestart=="2020-12-03"
	replace ncompleted=6 if datestart=="2020-12-11"
	replace ncompleted=4 if datestart=="2020-12-12"
	replace ncompleted=1 if datestart=="2020-12-13"
	replace ncompleted=3 if datestart=="2020-12-14"
	replace ncompleted=0 if datestart=="2020-12-15"
	replace ncompleted=1 if datestart=="2020-12-16"
	replace ncompleted=2 if datestart=="2020-12-18"
	replace ncompleted=6 if datestart=="2020-12-21"
	replace ncompleted=5 if datestart=="2020-12-22"
	replace ncompleted=2 if datestart=="2020-12-23"
	replace ncompleted=1 if datestart=="2020-12-26"
	replace ncompleted=1 if datestart=="2021-01-01"
	replace ncompleted=0 if datestart=="2021-01-05"
	replace ncompleted=1 if datestart=="2021-01-07"
	replace ncompleted=0 if datestart=="2021-01-26"

	*add info on npartial
	gen npartial=0 if datestart=="2020-09-30"
	replace npartial=4 if datestart=="2020-10-01"
	replace npartial=1 if datestart=="2020-10-02"
	replace npartial=2 if datestart=="2020-10-08"
	replace npartial=4 if datestart=="2020-10-09"
	replace npartial=0 if datestart=="2020-10-10"
	replace npartial=0 if datestart=="2020-10-12"
	replace npartial=0 if datestart=="2020-10-16"
	replace npartial=0 if datestart=="2020-10-17"
	replace npartial=0 if datestart=="2020-10-19"
	replace npartial=1 if datestart=="2020-10-20"
	replace npartial=0 if datestart=="2020-10-29"
	replace npartial=0 if datestart=="2020-10-31"
	replace npartial=0 if datestart=="2020-11-01"
	replace npartial=1 if datestart=="2020-11-02"
	replace npartial=1 if datestart=="2020-11-03"
	replace npartial=0 if datestart=="2020-11-10"
	replace npartial=2 if datestart=="2020-11-11"
	replace npartial=1 if datestart=="2020-11-12"
	replace npartial=2 if datestart=="2020-11-13"
	replace npartial=0 if datestart=="2020-11-14"
	replace npartial=3 if datestart=="2020-11-16"
	replace npartial=1 if datestart=="2020-11-18"
	replace npartial=0 if datestart=="2020-11-19"
	replace npartial=0 if datestart=="2020-11-20"
	replace npartial=1 if datestart=="2020-11-21"
	replace npartial=0 if datestart=="2020-11-22"
	replace npartial=0 if datestart=="2020-11-23"
	replace npartial=0 if datestart=="2020-11-24"
	replace npartial=0 if datestart=="2020-11-25"
	replace npartial=0 if datestart=="2020-11-26"
	replace npartial=1 if datestart=="2020-11-30"
	replace npartial=0 if datestart=="2020-12-01"
	replace npartial=1 if datestart=="2020-12-03"
	replace npartial=5 if datestart=="2020-12-11"
	replace npartial=3 if datestart=="2020-12-12"
	replace npartial=0 if datestart=="2020-12-13"
	replace npartial=2 if datestart=="2020-12-14"
	replace npartial=3 if datestart=="2020-12-15"
	replace npartial=0 if datestart=="2020-12-16"
	replace npartial=0 if datestart=="2020-12-18"
	replace npartial=5 if datestart=="2020-12-21"
	replace npartial=1 if datestart=="2020-12-22"
	replace npartial=0 if datestart=="2020-12-23"
	replace npartial=1 if datestart=="2020-12-26"
	replace npartial=0 if datestart=="2021-01-01"
	replace npartial=1 if datestart=="2021-01-05"
	replace npartial=0 if datestart=="2021-01-07"
	replace npartial=1 if datestart=="2021-01-26"

	*add info on cumulative_ncompleted
	gen cumulative_ncompleted=7 if datestart=="2020-09-30"
	replace cumulative_ncompleted=17 if datestart=="2020-10-01"
	replace cumulative_ncompleted=20 if datestart=="2020-10-02"
	replace cumulative_ncompleted=23 if datestart=="2020-10-08"
	replace cumulative_ncompleted=31 if datestart=="2020-10-09"
	replace cumulative_ncompleted=32 if datestart=="2020-10-10"
	replace cumulative_ncompleted=33 if datestart=="2020-10-12"
	replace cumulative_ncompleted=37 if datestart=="2020-10-16"
	replace cumulative_ncompleted=38 if datestart=="2020-10-17"
	replace cumulative_ncompleted=43 if datestart=="2020-10-19"
	replace cumulative_ncompleted=43 if datestart=="2020-10-20"
	replace cumulative_ncompleted=44 if datestart=="2020-10-29"
	replace cumulative_ncompleted=48 if datestart=="2020-10-31"
	replace cumulative_ncompleted=49 if datestart=="2020-11-01"
	replace cumulative_ncompleted=52 if datestart=="2020-11-02"
	replace cumulative_ncompleted=52 if datestart=="2020-11-03"
	replace cumulative_ncompleted=55 if datestart=="2020-11-10"
	replace cumulative_ncompleted=58 if datestart=="2020-11-11"
	replace cumulative_ncompleted=59 if datestart=="2020-11-12"
	replace cumulative_ncompleted=60 if datestart=="2020-11-13"
	replace cumulative_ncompleted=61 if datestart=="2020-11-14"
	replace cumulative_ncompleted=69 if datestart=="2020-11-16"
	replace cumulative_ncompleted=72 if datestart=="2020-11-18"
	replace cumulative_ncompleted=74 if datestart=="2020-11-19"
	replace cumulative_ncompleted=77 if datestart=="2020-11-20"
	replace cumulative_ncompleted=77 if datestart=="2020-11-21"
	replace cumulative_ncompleted=78 if datestart=="2020-11-22"
	replace cumulative_ncompleted=79 if datestart=="2020-11-23"
	replace cumulative_ncompleted=82 if datestart=="2020-11-24"
	replace cumulative_ncompleted=83 if datestart=="2020-11-25"
	replace cumulative_ncompleted=84 if datestart=="2020-11-26"
	replace cumulative_ncompleted=86 if datestart=="2020-11-30"
	replace cumulative_ncompleted=90 if datestart=="2020-12-01"
	replace cumulative_ncompleted=91 if datestart=="2020-12-03"
	replace cumulative_ncompleted=97 if datestart=="2020-12-11"
	replace cumulative_ncompleted=101 if datestart=="2020-12-12"
	replace cumulative_ncompleted=102 if datestart=="2020-12-13"
	replace cumulative_ncompleted=105 if datestart=="2020-12-14"
	replace cumulative_ncompleted=105 if datestart=="2020-12-15"
	replace cumulative_ncompleted=106 if datestart=="2020-12-16"
	replace cumulative_ncompleted=108 if datestart=="2020-12-18"
	replace cumulative_ncompleted=114 if datestart=="2020-12-21"
	replace cumulative_ncompleted=119 if datestart=="2020-12-22"
	replace cumulative_ncompleted=121 if datestart=="2020-12-23"
	replace cumulative_ncompleted=122 if datestart=="2020-12-26"
	replace cumulative_ncompleted=123 if datestart=="2021-01-01"
	replace cumulative_ncompleted=123 if datestart=="2021-01-05"
	replace cumulative_ncompleted=124 if datestart=="2021-01-07"
	replace cumulative_ncompleted=124 if datestart=="2021-01-26"

	*add info on cumulative_npartial
	gen cumulative_npartial=0 if datestart=="2020-09-30"
	replace cumulative_npartial=4 if datestart=="2020-10-01"
	replace cumulative_npartial=5 if datestart=="2020-10-02"
	replace cumulative_npartial=7 if datestart=="2020-10-08"
	replace cumulative_npartial=11 if datestart=="2020-10-09"
	replace cumulative_npartial=11 if datestart=="2020-10-10"
	replace cumulative_npartial=11 if datestart=="2020-10-12"
	replace cumulative_npartial=11 if datestart=="2020-10-16"
	replace cumulative_npartial=11 if datestart=="2020-10-17"
	replace cumulative_npartial=11 if datestart=="2020-10-19"
	replace cumulative_npartial=12 if datestart=="2020-10-20"
	replace cumulative_npartial=12 if datestart=="2020-10-29"
	replace cumulative_npartial=12 if datestart=="2020-10-31"
	replace cumulative_npartial=12 if datestart=="2020-11-01"
	replace cumulative_npartial=13 if datestart=="2020-11-02"
	replace cumulative_npartial=14 if datestart=="2020-11-03"
	replace cumulative_npartial=14 if datestart=="2020-11-10"
	replace cumulative_npartial=16 if datestart=="2020-11-11"
	replace cumulative_npartial=17 if datestart=="2020-11-12"
	replace cumulative_npartial=19 if datestart=="2020-11-13"
	replace cumulative_npartial=19 if datestart=="2020-11-14"
	replace cumulative_npartial=22 if datestart=="2020-11-16"
	replace cumulative_npartial=23 if datestart=="2020-11-18"
	replace cumulative_npartial=23 if datestart=="2020-11-19"
	replace cumulative_npartial=23 if datestart=="2020-11-20"
	replace cumulative_npartial=24 if datestart=="2020-11-21"
	replace cumulative_npartial=24 if datestart=="2020-11-22"
	replace cumulative_npartial=24 if datestart=="2020-11-23"
	replace cumulative_npartial=24 if datestart=="2020-11-24"
	replace cumulative_npartial=24 if datestart=="2020-11-25"
	replace cumulative_npartial=24 if datestart=="2020-11-26"
	replace cumulative_npartial=25 if datestart=="2020-11-30"
	replace cumulative_npartial=25 if datestart=="2020-12-01"
	replace cumulative_npartial=26 if datestart=="2020-12-03"
	replace cumulative_npartial=31 if datestart=="2020-12-11"
	replace cumulative_npartial=34 if datestart=="2020-12-12"
	replace cumulative_npartial=34 if datestart=="2020-12-13"
	replace cumulative_npartial=36 if datestart=="2020-12-14"
	replace cumulative_npartial=39 if datestart=="2020-12-15"
	replace cumulative_npartial=39 if datestart=="2020-12-16"
	replace cumulative_npartial=39 if datestart=="2020-12-18"
	replace cumulative_npartial=44 if datestart=="2020-12-21"
	replace cumulative_npartial=45 if datestart=="2020-12-22"
	replace cumulative_npartial=45 if datestart=="2020-12-23"
	replace cumulative_npartial=46 if datestart=="2020-12-26"
	replace cumulative_npartial=46 if datestart=="2021-01-01"
	replace cumulative_npartial=47 if datestart=="2021-01-05"
	replace cumulative_npartial=47 if datestart=="2021-01-07"
	replace cumulative_npartial=48 if datestart=="2021-01-26"		
				
	label var datestart "date start"
	label var level "level of election"
	label var completed "completed 1/0"
	label var partial "partial 1/0"
	label var ncompleted "n completed"
	label var npartial "n partial"
	label var cumulative_ncompleted "N cumulative completed"
	label var cumulative_npartial "N cumulative partial"
	
	drop level
	rename level2 level
	order level
	
	saveold "field_regional.dta", replace version(12)

	
****3. FIELDWORK: NATIONAL/EU DATA FIGURE
	clear all
	*SET DIRECTORY
	
	use "surveydata_01.dta"
	split datestart, p(" ")
		
	recode completion (0=1) (1 2 3 4=0), into(completed)
	recode completion (0=0) (1 2 3 4=1), into(partial)
	
	keep datestart1 completed partial level
	
	rename datestart1 datestart

	label define level 1 "municipal" 2 "regional" 3 "national/EU", replace

	gen level2="municipal" if level==1
	replace level2="regional" if level==2
	replace level2="national/EU" if level==3
	
	sort datestart
	keep if level2=="national/EU"

	*to get information on n per day
	*collapse (sum) completed, by(datestart)
	*gen cumulative_ncompleted = sum(completed)
	
	*collapse (sum) partial, by(datestart)
	*gen cumulative_npartial = sum(partial)

	*add info on ncompleted
	gen ncompleted=7 if datestart=="2020-10-05"
	replace ncompleted=3 if datestart=="2020-10-06"
	replace ncompleted=1 if datestart=="2020-10-07"
	replace ncompleted=1 if datestart=="2020-10-08"
	replace ncompleted=1 if datestart=="2020-10-09"
	replace ncompleted=6 if datestart=="2020-10-13"
	replace ncompleted=1 if datestart=="2020-10-14"
	replace ncompleted=2 if datestart=="2020-10-15"
	replace ncompleted=1 if datestart=="2020-10-16"
	replace ncompleted=7 if datestart=="2020-10-19"
	replace ncompleted=0 if datestart=="2020-10-20"
	replace ncompleted=1 if datestart=="2020-10-22"
	replace ncompleted=0 if datestart=="2020-10-23"
	replace ncompleted=7 if datestart=="2020-10-31"
	replace ncompleted=4 if datestart=="2020-11-01"
	replace ncompleted=1 if datestart=="2020-11-02"
	replace ncompleted=0 if datestart=="2020-11-03"
	replace ncompleted=2 if datestart=="2020-11-05"
	replace ncompleted=4 if datestart=="2020-11-09"
	replace ncompleted=2 if datestart=="2020-11-10"
	replace ncompleted=0 if datestart=="2020-11-13"
	replace ncompleted=1 if datestart=="2020-11-15"
	replace ncompleted=1 if datestart=="2020-11-16"
	replace ncompleted=1 if datestart=="2020-11-17"
	replace ncompleted=1 if datestart=="2020-11-19"
	replace ncompleted=1 if datestart=="2020-11-20"
	replace ncompleted=5 if datestart=="2020-11-22"
	replace ncompleted=3 if datestart=="2020-11-23"
	replace ncompleted=2 if datestart=="2020-11-24"
	replace ncompleted=1 if datestart=="2020-11-25"
	replace ncompleted=0 if datestart=="2020-11-27"
	replace ncompleted=1 if datestart=="2020-11-30"
	replace ncompleted=1 if datestart=="2020-12-01"
	replace ncompleted=0 if datestart=="2020-12-03"
	replace ncompleted=1 if datestart=="2020-12-08"
	replace ncompleted=2 if datestart=="2020-12-09"
	replace ncompleted=1 if datestart=="2020-12-10"
	replace ncompleted=1 if datestart=="2020-12-11"
	replace ncompleted=1 if datestart=="2020-12-14"
	replace ncompleted=1 if datestart=="2020-12-15"
	replace ncompleted=2 if datestart=="2020-12-21"
	replace ncompleted=1 if datestart=="2020-12-23"

	*add info on npartial
	gen npartial=3 if datestart=="2020-10-05"
	replace npartial=1 if datestart=="2020-10-06"
	replace npartial=1 if datestart=="2020-10-07"
	replace npartial=0 if datestart=="2020-10-08"
	replace npartial=0 if datestart=="2020-10-09"
	replace npartial=3 if datestart=="2020-10-13"
	replace npartial=1 if datestart=="2020-10-14"
	replace npartial=0 if datestart=="2020-10-15"
	replace npartial=0 if datestart=="2020-10-16"
	replace npartial=4 if datestart=="2020-10-19"
	replace npartial=1 if datestart=="2020-10-20"
	replace npartial=0 if datestart=="2020-10-22"
	replace npartial=1 if datestart=="2020-10-23"
	replace npartial=4 if datestart=="2020-10-31"
	replace npartial=1 if datestart=="2020-11-01"
	replace npartial=0 if datestart=="2020-11-02"
	replace npartial=2 if datestart=="2020-11-03"
	replace npartial=0 if datestart=="2020-11-05"
	replace npartial=2 if datestart=="2020-11-09"
	replace npartial=0 if datestart=="2020-11-10"
	replace npartial=1 if datestart=="2020-11-13"
	replace npartial=0 if datestart=="2020-11-15"
	replace npartial=0 if datestart=="2020-11-16"
	replace npartial=0 if datestart=="2020-11-17"
	replace npartial=1 if datestart=="2020-11-19"
	replace npartial=1 if datestart=="2020-11-20"
	replace npartial=8 if datestart=="2020-11-22"
	replace npartial=2 if datestart=="2020-11-23"
	replace npartial=1 if datestart=="2020-11-24"
	replace npartial=2 if datestart=="2020-11-25"
	replace npartial=1 if datestart=="2020-11-27"
	replace npartial=0 if datestart=="2020-11-30"
	replace npartial=0 if datestart=="2020-12-01"
	replace npartial=1 if datestart=="2020-12-03"
	replace npartial=1 if datestart=="2020-12-08"
	replace npartial=0 if datestart=="2020-12-09"
	replace npartial=0 if datestart=="2020-12-10"
	replace npartial=0 if datestart=="2020-12-11"
	replace npartial=0 if datestart=="2020-12-14"
	replace npartial=0 if datestart=="2020-12-15"
	replace npartial=1 if datestart=="2020-12-21"
	replace npartial=0 if datestart=="2020-12-23"

	*add info on cumulative_ncompleted
	gen cumulative_ncompleted=7 if datestart=="2020-10-05"
	replace cumulative_ncompleted=10 if datestart=="2020-10-06"
	replace cumulative_ncompleted=11 if datestart=="2020-10-07"
	replace cumulative_ncompleted=12 if datestart=="2020-10-08"
	replace cumulative_ncompleted=13 if datestart=="2020-10-09"
	replace cumulative_ncompleted=19 if datestart=="2020-10-13"
	replace cumulative_ncompleted=20 if datestart=="2020-10-14"
	replace cumulative_ncompleted=22 if datestart=="2020-10-15"
	replace cumulative_ncompleted=23 if datestart=="2020-10-16"
	replace cumulative_ncompleted=30 if datestart=="2020-10-19"
	replace cumulative_ncompleted=30 if datestart=="2020-10-20"
	replace cumulative_ncompleted=31 if datestart=="2020-10-22"
	replace cumulative_ncompleted=31 if datestart=="2020-10-23"
	replace cumulative_ncompleted=38 if datestart=="2020-10-31"
	replace cumulative_ncompleted=42 if datestart=="2020-11-01"
	replace cumulative_ncompleted=43 if datestart=="2020-11-02"
	replace cumulative_ncompleted=43 if datestart=="2020-11-03"
	replace cumulative_ncompleted=45 if datestart=="2020-11-05"
	replace cumulative_ncompleted=49 if datestart=="2020-11-09"
	replace cumulative_ncompleted=51 if datestart=="2020-11-10"
	replace cumulative_ncompleted=51 if datestart=="2020-11-13"
	replace cumulative_ncompleted=52 if datestart=="2020-11-15"
	replace cumulative_ncompleted=53 if datestart=="2020-11-16"
	replace cumulative_ncompleted=54 if datestart=="2020-11-17"
	replace cumulative_ncompleted=55 if datestart=="2020-11-19"
	replace cumulative_ncompleted=56 if datestart=="2020-11-20"
	replace cumulative_ncompleted=61 if datestart=="2020-11-22"
	replace cumulative_ncompleted=64 if datestart=="2020-11-23"
	replace cumulative_ncompleted=66 if datestart=="2020-11-24"
	replace cumulative_ncompleted=67 if datestart=="2020-11-25"
	replace cumulative_ncompleted=67 if datestart=="2020-11-27"
	replace cumulative_ncompleted=68 if datestart=="2020-11-30"
	replace cumulative_ncompleted=69 if datestart=="2020-12-01"
	replace cumulative_ncompleted=69 if datestart=="2020-12-03"
	replace cumulative_ncompleted=70 if datestart=="2020-12-08"
	replace cumulative_ncompleted=72 if datestart=="2020-12-09"
	replace cumulative_ncompleted=73 if datestart=="2020-12-10"
	replace cumulative_ncompleted=74 if datestart=="2020-12-11"
	replace cumulative_ncompleted=75 if datestart=="2020-12-14"
	replace cumulative_ncompleted=76 if datestart=="2020-12-15"
	replace cumulative_ncompleted=78 if datestart=="2020-12-21"
	replace cumulative_ncompleted=79 if datestart=="2020-12-23"

	*add info on cumulative_npartial
	gen cumulative_npartial=3 if datestart=="2020-10-05"
	replace cumulative_npartial=4 if datestart=="2020-10-06"
	replace cumulative_npartial=5 if datestart=="2020-10-07"
	replace cumulative_npartial=5 if datestart=="2020-10-08"
	replace cumulative_npartial=5 if datestart=="2020-10-09"
	replace cumulative_npartial=8 if datestart=="2020-10-13"
	replace cumulative_npartial=9 if datestart=="2020-10-14"
	replace cumulative_npartial=9 if datestart=="2020-10-15"
	replace cumulative_npartial=9 if datestart=="2020-10-16"
	replace cumulative_npartial=13 if datestart=="2020-10-19"
	replace cumulative_npartial=14 if datestart=="2020-10-20"
	replace cumulative_npartial=14 if datestart=="2020-10-22"
	replace cumulative_npartial=15 if datestart=="2020-10-23"
	replace cumulative_npartial=19 if datestart=="2020-10-31"
	replace cumulative_npartial=20 if datestart=="2020-11-01"
	replace cumulative_npartial=20 if datestart=="2020-11-02"
	replace cumulative_npartial=22 if datestart=="2020-11-03"
	replace cumulative_npartial=22 if datestart=="2020-11-05"
	replace cumulative_npartial=24 if datestart=="2020-11-09"
	replace cumulative_npartial=24 if datestart=="2020-11-10"
	replace cumulative_npartial=25 if datestart=="2020-11-13"
	replace cumulative_npartial=25 if datestart=="2020-11-15"
	replace cumulative_npartial=25 if datestart=="2020-11-16"
	replace cumulative_npartial=25 if datestart=="2020-11-17"
	replace cumulative_npartial=26 if datestart=="2020-11-19"
	replace cumulative_npartial=27 if datestart=="2020-11-20"
	replace cumulative_npartial=35 if datestart=="2020-11-22"
	replace cumulative_npartial=37 if datestart=="2020-11-23"
	replace cumulative_npartial=38 if datestart=="2020-11-24"
	replace cumulative_npartial=40 if datestart=="2020-11-25"
	replace cumulative_npartial=41 if datestart=="2020-11-27"
	replace cumulative_npartial=41 if datestart=="2020-11-30"
	replace cumulative_npartial=41 if datestart=="2020-12-01"
	replace cumulative_npartial=42 if datestart=="2020-12-03"
	replace cumulative_npartial=43 if datestart=="2020-12-08"
	replace cumulative_npartial=43 if datestart=="2020-12-09"
	replace cumulative_npartial=43 if datestart=="2020-12-10"
	replace cumulative_npartial=43 if datestart=="2020-12-11"
	replace cumulative_npartial=43 if datestart=="2020-12-14"
	replace cumulative_npartial=43 if datestart=="2020-12-15"
	replace cumulative_npartial=44 if datestart=="2020-12-21"
	replace cumulative_npartial=44 if datestart=="2020-12-23"

	label var datestart "date start"
	label var level "level of election"
	label var completed "completed 1/0"
	label var partial "partial 1/0"
	label var ncompleted "n completed"
	label var npartial "n partial"
	label var cumulative_ncompleted "N cumulative completed"
	label var cumulative_npartial "N cumulative partial"
	
	drop level
	rename level2 level
	order level
	
	saveold "field_nationaleu.dta", replace version(12)
